package com.fll.protocol;

import java.util.Arrays;

/**
 * @author fanlei
 * @version 1.0
 * @date 2019年01月25日
 */
public class ProxyMessage {
    //心跳
    public static final byte TYPE_HEARTBEAT = 7;

    //认证
    public static final byte C_TYPE_AUTH = 1;

    //连接
    public static final byte TYPE_CONNECT = 3;

    //关闭连接
    public static final byte TYPE_DISCONNECT = 4;

    //
    public static final byte P_TYPE_TRANSFER = 5;
    public static final byte C_TYPE_WRITE_CONTROL = 6;
    /**
     * 操作类型
     */
    private byte type;

    private long serialNumber;
    /**
     * 统一资源标识符
     * 这里表示USER_ID + @ + 服务端生成的随机数（密钥）
     */
    private String uri;
    private byte[] data;

    public ProxyMessage() {
    }

    public void setUri(String uri) {
        this.uri = uri;
    }

    public String getUri() {
        return this.uri;
    }

    public byte[] getData() {
        return this.data;
    }

    public void setData(byte[] data) {
        this.data = data;
    }

    public byte getType() {
        return this.type;
    }

    public void setType(byte type) {
        this.type = type;
    }

    public long getSerialNumber() {
        return this.serialNumber;
    }

    public void setSerialNumber(long serialNumber) {
        this.serialNumber = serialNumber;
    }

    @Override
    public String toString() {
        return "ProxyMessage [type=" + this.type + ", serialNumber=" + this.serialNumber + ", uri=" + this.uri + ", data=" + Arrays.toString(this.data) + "]";
    }
}
